package com.lgy.service.impl;

import com.lgy.dao.CompanyDao;
import com.lgy.pojo.Company;
import com.lgy.service.ICompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CompanyServiceImpl implements ICompanyService {
    @Autowired
    private CompanyDao companyDao;

    @Override
    public int deleteByPrimaryKey(Integer companyid) {
        return companyDao.deleteByPrimaryKey(companyid);
    }

    @Override
    public int insert(Company record) {
        return companyDao.insert(record);
    }

    @Override
    public int insertSelective(Company record) {
        return companyDao.insertSelective(record);
    }

    @Override
    public Company selectByPrimaryKey(Integer companyid) {
        return companyDao.selectByPrimaryKey(companyid);
    }

    @Override
    public int updateByPrimaryKeySelective(Company record) {
        return companyDao.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Company record) {
        return companyDao.updateByPrimaryKey(record);
    }

    @Override
    public Boolean findByCompanyName(String companyName) {
       Company company = companyDao.findByCompanyName(companyName);
        if(company!=null){
            return false;
        }else return true;
    }

    @Override
    public Company findCompanyName(String companyname) {
        return companyDao.findByCompanyName(companyname);
    }
}
